<template>
  <div id="Rankinglist">
    <div class="container">
      <div class="header">
        <span class="bobafont bobamusic-prev" @click="$router.back(-1)"></span>
        <p>排行榜</p>
      </div>
      <p>榜单推荐</p>
      <div class="ranking">
        <div
          v-for="(item, index) in rankinglist.slice(6, 9)"
          :key="index"
          @click="goSonglistinformation(item)"
        >
          <div class="rankingpicture">
            <img :src="item.coverImgUrl+'?param=100y100'" width="100%" height="100%" />
          </div>
          <div class="rankingbrief">{{ item.name }}</div>
        </div>
      </div>
      <p>官方榜</p>
      <div class="officiallist">
        <div
          class="rankingbox"
          v-for="(item, index) in rankinglistinformation"
          :key="index"
          @click="goSonglistinformation(item)"
          v-show="item.tracks.length>0"
        >
          <div
            class="officialpicture"
          >
            <img :src="item.coverImgUrl+'?param=100y100'" width="100%" height="100%" />
          </div>
          <div class="officialranking">
            <div
              v-for="(item, index) in item.tracks"
              :key="index"
            >
              <p>
                <!-- {{ index + 1 }}.{{ item.tracks[0].first }} -
                {{ item.tracks[0].second }} -->
                {{ index + 1}}.{{ item.first }} -
                {{ item.second }}
              </p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { TopList } from "network/api/RecommendApi";
import { TopListDetail } from "network/api/RecommendApi";
export default {
  data() {
    return {
      rankinglist: [],
      rankinglistinformation: [],
    };
  },
  methods: {
    goSonglistinformation(item) {
      this.$router.push({ name: "songlistinformation",params:{item}});
    },
  },
  mounted() {
    TopList().then((res) => {
      this.rankinglist = res.data.list;
    });
    TopListDetail().then((res) => {
      this.rankinglistinformation = res.data.list;
      console.log(res);
    });
  },
};
</script>

<style>
#Rankinglist .container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #e5faf8;
  z-index: 2;
}
#Rankinglist .container .header {
  width: 100%;
  height: 50px;
  background: #acf6ef;
  display: flex;
}
#Rankinglist .container .header .bobafont {
  color: #fff;
  font-size: 27px;
  line-height: 50px;
  margin-left: 10px;
}
#Rankinglist .container .header p {
  color: #fff;
  font-size: 19px;
  margin-top: 16px;
  font-weight: normal;
}
#Rankinglist .container p {
  font-weight: bold;
  color: #2ae0c8;
  padding-left: 10px;
}
#Rankinglist .container .ranking {
  width: 95%;
  /* height: 130px; */
  /* background: red; */
  margin-top: -10px;
  margin-left: 10px;
  display: flex;
  justify-content: space-between;
}
#Rankinglist .container .ranking div {
  width: 28%;
  height: 127px;
  /* background: gold; */
}
#Rankinglist .container .ranking div .rankingpicture {
  width: 100%;
  height: 100px;
  /* background: green; */
}
#Rankinglist .container .ranking div .rankingpicture img {
  border-radius: 10px;
}
#Rankinglist .container .ranking div .rankingbrief {
  margin-top: 5px;
  width: 100%;
  height: 20px;
  /* background: green; */
  font-size: 10px;
  color: #2ae0c8;
}
#Rankinglist .container .officiallist {
  width: 100%;
  /* height: 61%; */
  background: #e5faf8;
  margin-top: -10px;
  /* margin-left: 10px; */
}
#Rankinglist .container .officiallist .rankingbox {
  width: 100%;
  height: 90px;
  /* background: blue; */
  margin-top: 10px;
  display: flex;
}
#Rankinglist .container .officiallist .rankingbox .officialpicture {
  width: 28%;
  height: 100%;
  /* background: green; */
}
#Rankinglist .container .officiallist .rankingbox .officialpicture img {
  border-radius: 10px;
  margin-left: 10px;
}
#Rankinglist .container .officiallist .rankingbox .officialranking {
  width: 70%;
  /* height: 100%; */
  /* background: green; */
  margin-left: 20px;
  overflow: hidden;
}
#Rankinglist .container .officiallist .rankingbox .officialranking div {
  width: 100%;
  height: 25%;
  /* background: red; */
  margin-top: 6px;
}
#Rankinglist .container .officiallist .rankingbox .officialranking div p {
  margin-top: 0px;
  padding-left: 0px;
  font-weight: normal;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  -o-text-overflow: ellipsis;
  font-size: 10px;
}
</style>